package top.kaoshanji.q1ch06a.aspects;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

import java.util.logging.Logger;

/**
 * @author kaoshanji
 * ^_^
 * create time 2025/4/28 16:52
 */
@Aspect
public class LoggingAspect {

    private Logger logger = Logger.getLogger(LoggingAspect.class.getName());

    public void setLogger(Logger logger) {
        this.logger = logger;
    }

    @Around("execution(* top.kaoshanji.q1ch06a.services.*.*(..))")
    public void log(ProceedingJoinPoint joinPoint) throws Throwable {
        logger.info("...方法执行前调用....");

        joinPoint.proceed();

        logger.info("...方法执行后调用....");

    }

}
